package com.yi.mall.common.utils;


import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 全局异常处理
 */
@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler{
    @ExceptionHandler(Exception.class)
    public Result exception(Exception e){
        log.error(e.getMessage(),e);
        return Result.fail(1000,e.getMessage());
    }

}
